﻿using Axiom.CodeManifold;
using Axiom.CodeManifold.WPF.ViewModels;
using System;
using System.IO;
using System.Windows;
using System.Windows.Controls;

namespace Axiom.CodeManifold.WPF.Views
{
	public partial class CodeManifoldView : UserControl
	{
		public CodeManifoldView()
		{
			InitializeComponent();
		}

		public CodeManifoldViewModel Model { get { return DataContext as CodeManifoldViewModel; } }

		private void OnAddingNewRow(object sender, AddingNewItemEventArgs e)
		{

		}

		private void OnLoaded(object sender, RoutedEventArgs e)
		{

		}

		private void OnNew(object sender, RoutedEventArgs e)
		{
			
		}

		private void OnRefresh(object sender, RoutedEventArgs e)
		{
			Model.RefreshModels();
		}

		private void OnRowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
		{

		}

		private void OnAutoCommentAllFiles(object sender, RoutedEventArgs e)
		{
			Model.AutoCommentAllFiles();
		}

		private void OnSelectedMethodChanged(object sender, SelectionChangedEventArgs e)
		{

		}

		private void OnToolBarLoaded(object sender, RoutedEventArgs e)
		{
			ToolBar toolBar = sender as ToolBar;
			var overflowGrid = toolBar.Template.FindName("OverflowGrid", toolBar) as FrameworkElement;
			if (overflowGrid != null)
			{
				overflowGrid.Visibility = Visibility.Collapsed;
			}
		}

		private void OnUndo(object sender, RoutedEventArgs e)
		{
			Model.Undo();
		}

		private void OnLaunchSolutions(object sender, RoutedEventArgs e)
		{
			Model.LaunchSolution();
		}

		private void OnFilter(object sender, System.Windows.Input.KeyEventArgs e)
		{

		}

		private void OnFilterClear(object sender, RoutedEventArgs e)
		{

		}

		private void OnSortMembers(object sender, RoutedEventArgs e)
		{
			Model.SortMembers();
		}

		private void OnCommentMembers(object sender, RoutedEventArgs e)
		{
			Model.AutoCommentMembers();
		}
	}
}
